package infraestrutura;

import java.util.Iterator;
import java.util.LinkedList;

import dominio.Usuario;

public class UsuarioSingleton {

	private static LinkedList<Usuario> instance;

	private UsuarioSingleton() { /* Vazio */ }

	public static LinkedList<Usuario> getInstance() {
		if(instance == null) {
			instance = new LinkedList<Usuario>();
			instance.add(new Usuario("teste","teste","Teste", 20, 'M'));
		}
		return instance;
	}

	public static void print() {
		Iterator<Usuario> elements = instance.iterator();
		System.out.println("Número de elementos = " + instance.size());
		while(elements.hasNext()) {
			Usuario current = elements.next();
			System.out.println("--\nLogin = " + current.getLogin() +
					"\nNome = " + current.getNome() + "\n");
		}
	}
}
